<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>调用等待信号的处理器</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.pcntl-signal-dispatch" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">pcntl_signal_dispatch</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.3.0, PHP 7)</p><p class="refpurpose"><span class="refname">pcntl_signal_dispatch</span> &mdash; <span class="dc-title">调用等待信号的处理器</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.pcntl-signal-dispatch-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>pcntl_signal_dispatch</strong></span>
    ( <span class="methodparam">void</span>
   ) : <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   函数<span class="function"><strong>pcntl_signal_dispatch()</strong></span>调用每个等待信号通过<span class="function"><a href="pcntl_signal.html" class="function">pcntl_signal()</a></span>
   安装的处理器。
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.pcntl-signal-dispatch-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>TRUE</code></strong>， 或者在失败时返回 <strong><code>FALSE</code></strong>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.pcntl-signal-dispatch-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-4326">
    <p><strong>Example #1 <span class="function"><strong>pcntl_signal_dispatch()</strong></span> 示例</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"安装信号处理器...\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">pcntl_signal</span><span style="color: #007700">(</span><span style="color: #0000BB">SIGHUP</span><span style="color: #007700">,&nbsp;&nbsp;function(</span><span style="color: #0000BB">$signo</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"信号处理器被调用\n"</span><span style="color: #007700">;<br />});<br /><br />echo&nbsp;</span><span style="color: #DD0000">"为自己生成SIGHUP信号...\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">posix_kill</span><span style="color: #007700">(</span><span style="color: #0000BB">posix_getpid</span><span style="color: #007700">(),&nbsp;</span><span style="color: #0000BB">SIGHUP</span><span style="color: #007700">);<br /><br />echo&nbsp;</span><span style="color: #DD0000">"分发...\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">pcntl_signal_dispatch</span><span style="color: #007700">();<br /><br />echo&nbsp;</span><span style="color: #DD0000">"完成\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

    <div class="example-contents"><p>以上例程的输出类似于：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
安装信号处理器...
为自己生成SIGHUP信号...
分发...
信号处理器被调用
完成
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.pcntl-signal-dispatch-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="pcntl_signal.html" class="function" rel="rdfs-seeAlso">pcntl_signal()</a> - 安装一个信号处理器</span></li>
    <li class="member"><span class="function"><a href="pcntl_sigprocmask.html" class="function" rel="rdfs-seeAlso">pcntl_sigprocmask()</a> - 设置或检索阻塞信号</span></li>
    <li class="member"><span class="function"><a href="pcntl_sigwaitinfo.html" class="function" rel="rdfs-seeAlso">pcntl_sigwaitinfo()</a> - 等待信号</span></li>
    <li class="member"><span class="function"><a href="pcntl_sigtimedwait.html" class="function" rel="rdfs-seeAlso">pcntl_sigtimedwait()</a> - 带超时机制的信号等待</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>